import { axios } from '@/utils/request'

/**
 * 获取验证码接口
 * @param {*} sid 唯一标识
 */
export const getCode = (sid) => {
  return axios.request({
    url: '/auiu-admin/admin/code/image',
    responseType: 'arraybuffer',
    headers: {
      deviceId: sid
    },
    method: 'get'
  })
}

/**
 * 获取用户token
 *
 * @param {*} 登录参数
 * @returns 返回用户token
 */
export const login = (loginInfo) => {
  const data = { ...loginInfo }
  return axios.request({
    url: '/auiu-admin/admin/login',
    headers: {
      deviceId: data.sid
    },
    data,
    method: 'post'
  })
}
